package com.moxie.ocr.ocr.card;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.moxie.ocr.R;
import com.moxie.ocr.ocr.base.MXGlobalVar;
import com.moxie.ocr.ocr.view.RoundedImageView;



public class ConfirmPictureActivity extends Activity {
    private static final String TAG = "ConfirmPictureActivity";

    private ImageView mIvBack;
    private RoundedImageView mRivConfirmPicture;
    private TextView mTvReCapture;
    private TextView mTvUse;

    private Bitmap mBitmap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_confirm_picture);
        initView();
        initData();
    }

    private void initView() {
        mIvBack = (ImageView) findViewById(R.id.id_iv_back);
        mRivConfirmPicture = (RoundedImageView) findViewById(R.id.id_riv_confirm_picture);
        mTvReCapture = (TextView) findViewById(R.id.tv_recapture);
        mTvUse = (TextView) findViewById(R.id.tv_use);

        // 返回
        mIvBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        // 重拍
        mTvReCapture.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        // 使用照片
        mTvUse.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 识别交回给CardActivity
                finish();
            }
        });
    }

    private void initData() {
        mBitmap = MXGlobalVar.sCardBitmap;
        mRivConfirmPicture.setImageBitmap(mBitmap);
    }

}
